home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ADVHSC18.ZIP / EXAMPLE3.PAS < prev    next >
Pascal/Delphi Source File  |  1994-06-20  |  2KB  |  96 lines

  1. Program HSCExample;
  2.  
  3. { Little Example To Show The Use Of The Antares HSC Player }
  4. { Coded By Access/ADV - 05/94 }
  5. { Modified By Access/ADV - 06/94 }
  6.  
  7. { Polling Version }
  8.  
  9. Uses Crt,ADVHSC;
  10.  
  11. { The 3 Following Routine Were Extracted From The Antares GFX Tpu }
  12. { Coming Soon On Your Screen ... }
  13.  
  14. PROCEDURE VerticalRetrace; Assembler;
  15. ASM
  16.         mov dx,$3da
  17. @1:     in al,dx
  18.         test al,8
  19.         jz @1
  20. @2:     in al,dx
  21.         test al,8
  22.         jnz @2
  23. END;
  24.  
  25. PROCEDURE Wait4Line;Assembler;
  26. ASM
  27.         mov dx,$3da
  28. @1:     in al,dx
  29.         test al,1
  30.         jnz @1
  31. @2:     in al,dx
  32.         test al,1
  33.         jz @2
  34. END;
  35.  
  36. PROCEDURE SetColor(Nr,R,G,B:Byte);Assembler;
  37. Asm
  38.   mov  dx, 3C8h   {Color port}
  39.   mov  al, Nr  {number of color to change}
  40.   out  dx, al
  41.   inc  dx         {inc dx to write}
  42.   mov  al, r      {red value}
  43.   out  dx, al
  44.   mov  al, g      {green}
  45.   out  dx, al
  46.   mov  al, b      {blue}
  47.   out  dx, al
  48. END;
  49.  
  50. Var i,CountAdd:Byte;
  51.     j,Count:Word;
  52.  
  53. Begin
  54. LOADSONG('MUSIC.HSC');  { Loading the Song Into Memory }
  55.  
  56. SetMode(1,1); { Turn Polling Mode On And Tell HSC To Call The Old Interrupt }
  57. PLAYSONG; { Play The Song }
  58.  
  59. Count:=0; { InitiaLiZe Raster Variable }
  60. CountAdd:=1;
  61. Repeat
  62.  
  63. if Count=200 then CountAdd:=0; { Sum Test For The Raster }
  64. if Count=0 then CountAdd:=1;
  65. if CountAdd=0 then Dec(Count) Else Inc(Count);
  66.  
  67. VerticalRetrace; { Wait For Video Vertical Retrace }
  68.  
  69. Asm
  70.    Cli  { Turn Off All Interrupt - Used To Avoid A Interruption During
  71.           The Raster Process }
  72. End;
  73.  
  74. For j:=1 to Count Do Wait4Line; { Wait The Line Number J }
  75. For i:=0 to 63 Do { Do The FadeIn Raster }
  76. Begin
  77.      Wait4Line;
  78.      SetColor(0,i,i,i);
  79. End;
  80. For i:=63 Downto 0 do { Do The FadeOut Raster }
  81. Begin
  82.      Wait4Line;
  83.      SetColor(0,i,i,i);
  84. End;
  85.  
  86. Asm
  87.    Sti  { Turn Interrupt On Again }
  88. End;
  89.  
  90. POLLMUSIC;  { Call The Player To Do Some Music }
  91.             { Must Be Called At Least 18x By Second }
  92. Until KeyPressed;
  93.  
  94. STOPSONG; { Stop The Player }
  95. CLEARMEM; { Free Memory }
  96. End.